package com.nyist.zk.service.impl;

import com.nyist.zk.dao.DoctorDao;
import com.nyist.zk.entities.Doctor;
import com.nyist.zk.service.DoctorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.beans.Transient;
import java.util.List;

@Service
public class DoctorServiceImpl implements DoctorService {

    @Autowired
    private DoctorDao DoctorDao;

    @Override
    public boolean getDoctorByIdAndPassword(Integer d_id, String d_password) {
        Doctor doctor = DoctorDao.getDoctorByIdAndPassword(d_id,d_password);
        if (doctor != null) {
            return true;
        }
        return false;
    }

    @Override
    public List<Doctor> findAllDoctor() {
        return DoctorDao.findAllDoctor();
    }

    @Override
    public List<Doctor> findDoctorByNameLike(String d_name) {
        return DoctorDao.findDoctorByNameLike(d_name);
    }

    @Override
    public Doctor findByIdDoctor(Integer d_id) {
        return DoctorDao.findByIdDoctor(d_id);
    }

    @Override
    @Transient
    public void insertDoctor(Doctor Doctor) {
        DoctorDao.insertDoctor(Doctor);
    }

    @Override
    @Transient
    public void deleteByIdDoctor(Integer d_id) {
        DoctorDao.deleteByIdDoctor(d_id);
    }

    @Override
    @Transient
    public void updateDoctor(Doctor Doctor) {
        DoctorDao.updateDoctor(Doctor);
    }

}
